<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>documentName</title>
    <link rel="stylesheet" href="/layui/dist/css/layui.css" />
  </head>
  <body>
    <div id="demo"></div>

    <script src="/layui/dist/layui.js"></script>
    <script src="/layui/layui-treetable/common.js"></script>
    <script>
      layui
        .config({
          base: '/layui/extends_modules',
        })
        .extend({
          treetable: '/layui-treetable/treetable',
        })
        .use(['form', 'treetable', 'layer'], function () {
          var layer = layui.layer,
            form = layui.form,
            $ = layui.jquery,
            treetable = layui.treetable

          function treetableBeforeCheck(node) {
            console.log(1, '勾选/取消勾选 之前的事件回调函数')
            console.log(2, '参数', node)
            // 见./19-1-3.js
            return true // （默认）返回，允许勾选
          }

          function treetableOnCheck(node) {
            console.log(11, '勾选/取消勾选 之前的事件回调函数')
            console.log(22, '参数', node)
            return true // （默认）返回，允许勾选
          }

          var tree = layui.treetable({
            elem,
            spreadable,
            checkbox,
            layout,
            nodes,
            // 以上为一个通用的结构

            callback: {
              beforeCheck: treetableBeforeCheck,
              onCheck: treetableOnCheck,
            },
          })

          form.render()
        })
    </script>
  </body>
</html>
